import { mapMutations, mapState } from 'vuex';
import { queryEnterpriseTypeService } from '@api/supplier/components';
export default {
  computed: {
    ...mapState('supplier/enterpriseInfo', [ 'enterpriseInfoTypes', ]),
  },
  created () {
    if (!this.enterpriseInfoTypes || !this.enterpriseInfoTypes.length) {
      this.getEnterpriseInfoTypes()
    }
  },
  methods: {
    ...mapMutations('supplier/enterpriseInfo', [ 'setEnterpriseInfoTypes', ]),
    async getEnterpriseInfoTypes () {
      const { result } = await queryEnterpriseTypeService()
      if (result && result.length) {
        this.setEnterpriseInfoTypes(result)
      }
    },
  }
}
